home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
pascal
/
pull5x.zip
/
PULLDATA.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1989-01-01
|
20KB
|
651 lines
{ =========================================================================== }
{ PullData.pas - User Statistics for data-entry windows. ver 5.Xa, 01-11-89 }
{ }
{ This file contains all the data to configure the data-entry fields in }
{ data windows or work windows. }
{ Copyright (c) 1987-1989 James H. LeMay, All rights reserved. }
{ =========================================================================== }
{ R-,S-,I-,D-,T-,F-,V-,B-,N-,L+ } { TP4 directives }
{$A-,B-,D-,E-,F-,I-,L-,N-,O-,R-,S-,V-} { TP5 directives }
{$define UseMsgLineCode }
UNIT PullData;
INTERFACE
uses
Crt,Qwik,Strs,Wndw,Pull,PullDir,PullStat;
{ ================ Set up variables for data windows here: ================== }
{ Place your variables names here to interface with the menus. }
{ Careful! -- there's NO type checking for parameters in Transfer. You MUST }
{ be certain case statement, DataWndw, and TypeOfData all match. Be }
{ especially careful of string lengths that are too long. They can be no }
{ longer than DataStrSize. }
{ --------------------------------------------------------------------------- }
const
aByte: byte = 129;
aWord: word = 50000;
aShortInt: shortint = -10;
aInteger: integer = -31456;
aLongInt: longint = -123456789;
aReal: real = -24.34565E06;
aHex: string[4] = 'FF03';
aChar: char = 'Q';
aString: CrtStrType = 'This is a string';
aByte2: byte = 219;
aWord2: word = 45600;
aShortInt2: shortint = -34;
aInteger2: integer = -1100;
aLongInt2: longint = -98765432;
aReal2: real = -19.07070E12;
aHex2: string[4] = 'FFFF';
aChar2: char = 'W';
aString2: CrtStrType = 'This is another string';
Seats: byte = 4;
Years: byte = 30;
Month: byte = 1;
Day: byte = 12;
Year: integer = 1989;
PriceLimit: integer = 2000;
type
DataEntryNames = (
NoDE,aByte2DE,aWord2DE,aShortInt2DE,aInteger2DE,aLongInt2DE,aReal2DE,
aHex2DE,aChar2DE,aString2DE,FileNameDE);
var
PathName: string[67]; { for the pull-down directory }
DataEntryOattr, { Output attribute }
DataEntryIattr, { Input attribute }
DataWndwIattr, { Input attribute }
DataWndwOattr, { Output attribute }
DataWndwBattr: byte; { Border attribute }
DataWndwBrdr: Borders;
IMPLEMENTATION
{ ================ Set up your Error Message Lines here: ================== }
{ Error Messages are used for indicating that data entry was invalid or out }
{ of range. ErrMsgLine[1] is reserved for custom error messages that you }
{ can create at runtime. Messages up to InvalidEM are reserved and must }
{ match those in PULL.PAS. }
{ ------------------------------------------------------------------------- }
type
ErrMsgNames = (NoEM,UserEM,InvalidEM,PathEM,RealEM,CharEM,StrEM);
{$ifdef UseMsgLineCode }
procedure GetErrMsgs;
begin
AutoNumLock := false; { If true, turns on NumLock on with data entry }
CapsLockCol := 41; { First column for ' CAPS NUM SCROLL ' on MsgLine. }
ErrMsgLine[ord(InvalidEM)]:=' Invalid entry. ESC-acknowledge';
ErrMsgLine[ord(PathEM)] :=' Invalid path. Use [d:][path]. Press ESC.';
ErrMsgLine[ord(RealEM)] :=' Range: <=4.0e12 ESC-acknowledge';
ErrMsgLine[ord(CharEM)] :=' "?" not allowed ESC-acknowledge';
ErrMsgLine[ord(StrEM)] :=' At least 3 chars required. ESC-acknowledge';
end;
{$endif UseMsgLineCode }
procedure MakeErrMsg (Low,High: longint);
begin
{$ifdef UseMsgLineCode }
DataPad.ErrMsg := ord(UserEM);
ErrMsgLine[ord(UserEM)] :=
'Range: '+StrL(Low)+' to '+StrL(High)+'. Press ESC';
{$endif }
end;
{ ====================== Data Entry Range Checking ========================== }
{ These procedures are completely defined by the user. They may not even be }
{ necessary if the string entered is satisfactory as a valid number. The }
{ calls must be forced to FAR because they are called indirectly. }
{ "Translate" can alter each key from the keyboard before it gets evaluated. }
{ "Verify" will check the range or even completely alter the entire string. }
{ --------------------------------------------------------------------------- }
{$F+}
procedure VerifyPath;
begin
with DataPad do
begin
{$I-} ChDir (Sdata); {$I+} { Check for valid directory }
if IOresult<>0 then
ErrMsg := ord(PathEM)
else GetDir (0,PathName); { Have DOS parrot the path name }
end;
end;
procedure VerifyFileMask;
begin
with DataPad do
if Sdata='' then
Sdata:='*.*';
end;
procedure VerifyPriceLimit;
begin
with DataPad do
if ((Idata>25000) or (Idata<=0)) then
MakeErrMsg (1,25000);
end;
procedure VerifyMonth;
begin
with DataPad do
if ((Bdata=0) or (Bdata>12)) then
MakeErrMsg (1,12);
end;
procedure VerifyDay;
begin
with DataPad do
if ((Bdata=0) or (Bdata>31)) then
MakeErrMsg (1,31);
end;
procedure VerifyYear;
begin
with DataPad do
if ((Idata<1960) or (Idata>2010)) then
MakeErrMsg (1960,2010);
end;
procedure VerifyYears;
begin
with DataPad do
if ((Idata<4) or (Idata>30)) then
MakeErrMsg (4,30);
end;
{ -------------------- Work Window Data Entry Checking ---------------------- }
procedure TranslateCase;
begin
if not ExtKey then
Key := upcase(Key); { Simple upper case translation }
end;
procedure VerifyByte2;
begin
with DataPad do
if ((Bdata>200) or (Bdata=0)) then
MakeErrMsg (1,200);
end;
procedure VerifyWord2;
begin
with DataPad do
if ((Wdata>45000) or (Wdata=0)) then
MakeErrMsg (1,45000);
end;
procedure VerifyShortInt2;
begin
with DataPad do
if ((SIdata>101) or (SIdata<-50)) then
MakeErrMsg (-50,101);
end;
procedure VerifyInteger2;
begin
with DataPad do
if ((Idata>20000) or (Idata<-10000)) then
MakeErrMsg (-10000,20000);
end;
procedure VerifyLongInt2;
begin
with DataPad do
if ((Ldata>850000) or (Ldata<-1000000)) then
MakeErrMsg (-1000000,850000);
end;
procedure VerifyReal2;
begin
with DataPad do
if (Rdata>4.0e12) then
ErrMsg := ord(RealEM);
end;
procedure VerifyChar2;
begin
with DataPad do
if (Cdata='?') then
ErrMsg := ord(CharEM);
end;
procedure VerifyString2;
begin
with DataPad do
if ord(Sdata[0])<3 then
ErrMsg := ord(StrEM);
end;
{$F-}
{ ======================== GetUserDataEntry ================================= }
{ The major configurations for all menus go here. The program first clears }
{ all RECORD values to $00. The values below will set new values. Therefore, }
{ setting RECORD values to "false", nil, or the like is not necessary. }
{ --------------------------------------------------------------------------- }
{ Code saving utilities: }
procedure GetDataWndw (Index: word);
begin
DWI := Index;
TopDataWndw := DataWndw^[DWI];
end;
procedure SaveDataWndw;
begin
DataWndw^[DWI] := TopDataWndw;
end;
procedure GetDataEntry (Index: word);
begin
DEI := Index;
TopEntry := DataEntry^[DEI];
end;
procedure SaveDataEntry;
begin
DataEntry^[DEI] := TopEntry;
end;
procedure GetDataEntryStats;
begin
{ ------------- Set up your PULL-DOWN Data Windows here: ------------------ }
{ Justification will default with numbers right justified and string to }
{ the left if none is specified. }
with TopDataWndw,TopDataWndw.Entry do
begin
GetDataWndw (ord(BytesDW));